//
//  TF_TitleButton.swift
//  TalkfunSDKDemo
//
//  Created by 莫瑞权 on 2022/2/18.
//  Copyright © 2022 Talkfun. All rights reserved.
//

import UIKit

class TF_TitleButton: UIButton {
    @objc public var Underline = UIView()
    override init(frame: CGRect) {
        super.init(frame: frame)

        self.Underline.isHidden = true
        self.Underline.backgroundColor = UIColor(red: 1/255.0, green: 194/255.0, blue: 255/255.0, alpha: 1.0)
        self.addSubview(self.Underline)
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        if (self.frame.size.height >= 2 && self.frame.size.width >= 30) {
            
            let UnderlineX = (self.frame.size.width - 30 )/2
            self.Underline.frame = CGRect(x: UnderlineX, y: self.frame.size.height - 2, width: 30, height: 2)
            

        }
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
